<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="script/vue-2.4.0.js"></script>
</head>

<body>
    <div id="app">
        <ol>
            <!-- toFixed(2)保留2位小数 --->
            <li>姓名：{{student.name}}</li>
            <li>身份证号位数：{{student.cardID.length}} 位</li>
            <li>Java成绩:{{student.javaNum.toFixed(2)}}</li>
            <li>Python成绩:{{student.pythonNum.toFixed(2)}}</li>
            <li>
                平均成绩：{{((student.javaNum+student.pythonNum)/2).toFixed(2) }}
            </li>
        </ol>
    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                //定义一个JSON对象，对象是student
                student: {
                    //姓名、身份证号、Java成绩、Python成绩：
                    name: 'Tom',
                    cardID: '130110199909027867', //身份证号是字符串类型，获得字符串的字符个数：.length
                    javaNum: 90.0,
                    pythonNum: 95.5,
                },
                // codeVersion: '1.0.0',
                //JSON对象的数组 v-for指令
            },
        })
    </script>
</body>

</html>